﻿using GraphQL;
using GraphQL.Http;
using GraphQL.Types;
using GraphQLDomain.Operations.Querys;
using GraphQLDomain.Types;
using Microsoft.Extensions.DependencyInjection;

namespace GraphQLDomain
{
    public static partial class ServiceExtension
    {
        public static void AddGraphQL(this IServiceCollection services)
        {
            services.AddTransient<IDocumentExecuter, DocumentExecuter>();
            services.AddTransient<IDocumentWriter, DocumentWriter>();
            #region 基础类型
            services.AddTransient<BaseEntityInterface>();
            services.AddTransient<GenderEnumType>();
            services.AddTransient<UserType>();
            services.AddTransient<CompanyType>();
            services.AddTransient<EmployeeType>();

            #endregion


            #region Query类型
            services.AddTransient<Query>();
            services.AddTransient<AccountGroupQuery>();
            services.AddTransient<CompanyGroupQuery>();
            services.AddTransient<EmployeeGroupQuery>();
            #endregion

            services.AddTransient<ISchema, GraphSchema>();
        }
    }
}
